﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mapping.ByCode.Conformist;
using YK.Component.Tools;
using NHibernate.Mapping.ByCode;

namespace YK.Infrastructure.NH.Mapping
{
    public class MappingBase<TEntity> : ClassMapping<TEntity> where TEntity : EntityBase
    {
        public MappingBase()
        {

        }
        public MappingBase(string tableName, string pkColName)
        {
            Table(tableName);
            var entity = default(TEntity);

            Id(m => entity.Id, map =>
            {
                map.Column(pkColName);
                map.Generator(Generators.Assigned);
                //map.Generator(Generators.Sequence, gmap => gmap.Params(new { max_low = 100, sequence = "HI_VALUE_SEQ" }));
            });

            // Version(x => x.Version, map => { });
        }
    }
}
